package com.platform.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.platform.dao.FarmUnitMapper;
import com.platform.entity.FarmContentEntity;
import com.platform.entity.FarmUnitEntity;


/**
 * 单元表三级Service实现类
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2020-02-10 22:02:35
 */
@Service("farmUnitService")
public class FarmUnitService{
    @Autowired
    private FarmUnitMapper farmUnitMapper;

    /**
     * 根据parentId查找
     * @param id
     * @return
     */
     public List<FarmUnitEntity> findByParentId(Integer id){
     	return farmUnitMapper.findByParentId(id);
     }
    public FarmUnitEntity queryObject(Integer id) {
        return farmUnitMapper.selectByPrimaryKey(id);
    }

    
    public List<FarmUnitEntity> queryList(Map<String, Object> map) {
        return farmUnitMapper.queryList(map);
    }

    
    public int queryTotal(Map<String, Object> map) {
        return farmUnitMapper.queryTotal(map);
    }

    
    public int save(FarmUnitEntity farmUnit) {
        return farmUnitMapper.insertSelective(farmUnit);
    }

    
    public int update(FarmUnitEntity farmUnit) {
        return farmUnitMapper.updateByPrimaryKeySelective(farmUnit);
    }

    
    public int delete(Integer id) {
        return farmUnitMapper.deleteByPrimaryKey(id);
    }

    
    public int deleteBatch(Integer[] ids) {
        return farmUnitMapper.deleteBatch(ids);
    }
}
